# Maintainer: George Rawlinson <grawlinson@archlinux.org>

pkgname=python-minio
pkgver=7.1.13
pkgrel=2
pkgdesc='MinIO Python Library for Amazon S3 Compatible Cloud Storage'
arch=('any')
url='https://github.com/minio/minio-py'
license=('Apache')
depends=(
  'python'
  'python-certifi'
  'python-urllib3'
)
makedepends=(
  'git'
  'python-build'
  'python-installer'
  'python-wheel'
  'python-setuptools'
)
checkdepends=(
  'minio'
  'python-pytest'
)
_commit='3d5f32606b6500af1c2ede7dbf217e87cbc76bc7'
source=("$pkgname::git+$url.git#commit=$_commit")
b2sums=('SKIP')

pkgver() {
  cd "$pkgname"

  git describe --tags
}

prepare() {
  cd "$pkgname"

  ln -sf /usr/bin/minio tests/functional/minio
}

build() {
  cd "$pkgname"

  python -m build --wheel --no-isolation
}

check() {
  cd "$pkgname"

  python -m pytest

  ./run_functional_tests.sh
}

package() {
  cd "$pkgname"

  python -m installer --destdir="$pkgdir" dist/*.whl
}
